-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add toggle for time-sensitive tests. #677
Conversation
Motivation: Sometimes, like when running under TSan, it's useful to disable long running tests, or those which are sensitive to time. Modifications: Add an option to disable time sensitive tests via an envrionment variable. Result: Certain tests are skipped if `ENABLE_TIMING_TESTS` is set to false.
Fixes #621 |
Fixes #437 |
Tests/GRPCTests/GRPCTestCase.swift
Outdated
@@ -24,7 +24,26 @@ class GRPCTestCase: XCTestCase { | |||
// locally; conditionally enable it based on the environment. | |||
// | |||
// https://docs.travis-ci.com/user/environment-variables/#default-environment-variables | |||
private static var isLoggingEnabled = ProcessInfo.processInfo.environment["CI"] != "true" | |||
private static let isLoggingEnabled = !Bool( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!Bool
looks a bit ugly — can we avoid that?
var runTimeSensitiveTests: Bool { | ||
let shouldRun = GRPCTestCase.runTimeSensitiveTests | ||
if !shouldRun { | ||
print("Skipping '\(self.name)' as ENABLE_TIMING_TESTS=false") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This side effect feels like a code small; at least convert this into a func
? Also, what will self.name
evaluate to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, let's make it a func. I'm okay with the side effect as it's only a print message in tests.
self.name
looks like "-[FunctionalTestsMutualAuthentication testUnaryLotsOfRequests]"
Motivation:
Sometimes, like when running under TSan, it's useful to disable long
running tests, or those which are sensitive to time.
Modifications:
Add an option to disable time sensitive tests via an envrionment
variable.
Result:
Certain tests are skipped if
ENABLE_TIMING_TESTS
is set to false.